<?php
require_once "jssdk.php";

$数据=pdo()->selectColumns('public_serv_accounts',array('AppSecret','app_id'),array('id'=>$_SESSION['vo用户数据']['公众号ID']));

$jssdk = new JSSDK($数据['app_id'], $数据['AppSecret']);
$signPackage = $jssdk->getSignPackage();

global $openId;
$openId=getCurrentUserOID();//id
$bm=new CUI数据中心(Page::m卖家中心_账目,$openId);
$完善资料=$bm->生成有效链接('Seller18ZiLiao',$_GET['state']);
$用户id = $_SESSION['vo用户数据']['id'];

$医师详情 = pdo()->selectOne("select 照片,资格证号 from 医师详情 where 用户id=".$用户id);
$医师工作证 = $医师详情['照片'];
$资格证号 = $医师详情['资格证号'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"/>
    <title>身份认证</title>
    <link rel="stylesheet" href="../style/common.css?<?=版本?>">
    <script src="../resource/js/jquery-1.11.1.min.js"></script>
    <script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="http://demo.open.weixin.qq.com/jssdk/js/api-6.1.js?ts=1420774989"></script>
    <script src="../../app/js/common.js"></script>
    <script type="text/javascript">

        var images = {
            localId: [],
            serverId: []
        };

        wx.config({
            debug: false,
            appId: '<?php echo $signPackage["appId"];?>',
            timestamp: <?php echo $signPackage["timestamp"];?>,
            nonceStr: '<?php echo $signPackage["nonceStr"];?>',
            signature: '<?php echo $signPackage["signature"];?>',
            jsApiList: [
                'startRecord',
                'stopRecord',
                'onRecordEnd',
                'playVoice',
                'pauseVoice',
                'stopVoice',
                'uploadVoice',
                'downloadVoice',
                'chooseImage',
                'previewImage',
                'uploadImage',
                'downloadImage',
                'onMenuShareAppMessage',
                'onMenuShareTimeline',
                'onMenuShareQQ',
                'onMenuShareWeibo',
                'onMenuShareQZone'
            ]
        });

        title = '爱贝儿医';
        desc = '爱贝儿医—专注于做儿科医生间学习工作交流平台。平台拥有数十位来自省级以上重点三甲医院的儿科专家、重点医院儿科学科带头人、国内儿科权威人士组成的豪华专家团队。';
        links = '';
        imgUrl = '<?= G_SITE_BASE ?>/business/img/logoRed2.png';
        weixinShare(title, desc, links, imgUrl);

        function uploadimg(){

            wx.chooseImage({
                count: 1, // 默认9
                sizeType: ['compressed'], // 可以指定是原图还是压缩图，默认二者都有
                sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
                success: function (res) {
                    localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                    syncUpload(localIds);
                }
            });
        }

        var syncUpload = function(localIds){
            var localId = localIds.pop();
            wx.uploadImage({
                localId: localId,

                isShowProgressTips: 1,

                success: function (res) {

                    var imageId = res.serverId; // 返回图片的服务器端ID

                    var userid = $('#用户id').val(); //get user id

                    $.post('agent_manages.php',{'imageId':imageId,"userid":userid,'参数':'上传医师工作证'},function(data){
                        $("#preview").attr("src",data);

                    })

                }
            });
        };


    </script>
</head>
<body>
<div class="localImagbig" onclick="uploadimg()">
    <div id="localImag">
        <div class="certificate">
            <img src="<?php if($医师工作证){echo $医师工作证;}else{echo 'style/dianji.png';}?>" id="preview" width="100%" height="100%" style="display: block; width: 100%; height: 100%;"/>
        </div>
    </div>
</div>
<form class="form-horizontal"   action="../commit.php"  method="post" enctype="multipart/form-data">
    <input type="hidden" name="businessFlag" value="医师工作牌">
    <input type="hidden" name="用户id" id="用户id" value="<?=$用户id?>">
    <input type="hidden" name="医师工作证" value="<?=$医师工作证?>">
    <!--头部固定-->
    <div class="header"><a href="<?=$完善资料?>" class="return">返回</a></div>

    <br/>
    <!-- 加入功能 -->
    <div class="doc-num"><input type="text" name="资格证号" value="<?=$资格证号?>" placeholder="请输入医师资格证号"/></div>
    <!-- 加入功能 -->
    <div style="text-align:center">
        <input name="" type="submit" onclick="" value="完 成" style="-webkit-appearance:none; background:#D02C4B;width:90%;height:40px;border-radius:5px;margin-top:20px;color:#fff;font-size:110%;"/>
    </div>
</form>
<div style="width:100%;height:30px;"></div>
<div style="height:30px;width:100%;background:#db3655;color:#fff;font-size:80%;line-height:30px;text-align:center;position:fixed;bottom:0px;">操作过程中如有疑问，请致电客服热线：400-825-8989</div></body>
</body>
</html>
